Skip to content

Update env for calling tools#8966

Merged
helin24 merged 4 commits into
flutter:mainfrom
helin24:dash-env
May 9, 2026
Merged

Update env for calling tools#8966
helin24 merged 4 commits into
flutter:mainfrom
helin24:dash-env

Conversation

@helin24
Copy link
Copy Markdown
Member

@helin24 helin24 commented May 8, 2026

Fixes #8850

I verified by putting System.out.println(commandLine.getEnvironment()); in SdkFields and checking that the new values are present, i.e.:

{DASH__SUPPRESS_ANALYTICS=>false, DASH__IDE_VERSION=>Panda 4 | 2025.3.4, DASH__PLUGIN_VERSION=>505.0.0, DASH__PLUGIN_NAME=>Dart, FLUTTER_HOST=>Android-Studio, DASH__IDE_NAME=>Android Studio, DASH__TOOL=>android-studio-plugins}

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates Analytics.updateEnvironment calls into various command-line generation methods across the Flutter plugin, including SdkFields, BazelFields, DevToolsServerTask, and FlutterCommand. A review comment points out a redundant call to Analytics.updateEnvironment in SdkFields.java, as the command-line object is already updated within the FlutterCommand class.

Comment thread src/io/flutter/run/SdkFields.java Outdated
@helin24 helin24 requested a review from pq May 8, 2026 18:12
Copy link
Copy Markdown
Collaborator

@pq pq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@helin24 helin24 merged commit 43aec57 into flutter:main May 9, 2026
8 checks passed
@helin24 helin24 deleted the dash-env branch May 9, 2026 06:35
@pq pq mentioned this pull request May 20, 2026
4 tasks
pq added a commit that referenced this pull request May 20, 2026
Follow-up from #8966 which introduced support for propagating the
standard JetBrains telemetry environment variables (`DASH__*` and
`FLUTTER_HOST`) via the `Analytics.updateEnvironment(commandLine)`
utility, this updates four additional spots where standalone processes
are spawned manually using the `GeneralCommandLine` class, ensuring
environment variables are propagated correctly in those contexts as
well.

Fixes: #8975 

---

### Changes

#### 1. Device Daemon Spawning
(`src/io/flutter/run/daemon/DeviceDaemon.java`)
* **Modification**: Invoked `Analytics.updateEnvironment(result)` inside
the `toCommandLine()` helper before returning the `GeneralCommandLine`
instance. This ensures the background `flutter daemon` process runs with
propagated telemetry parameters.

#### 2. Bazel Test Execution
(`src/io/flutter/run/bazelTest/BazelTestFields.java`)
* **Modification**: Invoked `Analytics.updateEnvironment(commandLine)`
in the `getLaunchCommand(...)` method before returning the constructed
command line, allowing the Bazel test runner process to receive the
telemetry variables.

#### 3. Bazel Flutter Doctor Execution
(`src/io/flutter/actions/FlutterDoctorAction.java`)
* **Modification**: Invoked `Analytics.updateEnvironment(cmdLine)` in
`runWorkspaceFlutterDoctorScript(...)` before spawning the
workspace-specific doctor script.

#### 4. Bazel File Synchronization
(`src/io/flutter/run/FlutterReloadManager.java`)
* **Modification**: Invoked `Analytics.updateEnvironment(commandLine)`
in the `syncFiles()` helper to propagate the environment variables to
the Bazel file synchronization script during reload events.

---

Review the contribution guidelines below:

- [x] I’ve reviewed the contributor guide and applied the relevant
portions to this PR.
- [x] I've included the required information in the description above.
- [x] My up-to-date information is in the `AUTHORS` file.
- [x] I've updated `CHANGELOG.md` if appropriate.

<details>
  <summary>Contribution guidelines:</summary><br>

- See
  our [contributor guide](../CONTRIBUTING.md) and
the [Flutter organization contributor
guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md)
  for general expectations for PRs.
- Larger or significant changes should be discussed in an issue before
creating a PR.
- Dart contributions to our repos should follow the [Dart style
guide](https://dart.dev/guides/language/effective-dart) and use
  `dart format`.
- Java and Kotlin contributions should strive to follow Java and Kotlin
best
practices
([discussion](#8098)).

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[analytics] Update the Flutter Plugin to set analytics ENV variables when invoking sub-tools

2 participants